package com.ljn.core.dto.common.utils.assmbler;

import com.ljn.core.dto.Teacher;
import com.ljn.core.dto.common.User;
import com.ljn.core.dto.common.command.usercommand.Registercommand;
import org.springframework.beans.BeanUtils;

/**
 * Created by 55966005 on 2017/11/3.
 */
public class TeacherAssmbler {

        public static Teacher toTeacher(Registercommand registerCommand) {
            Teacher teacher = new Teacher();
            BeanUtils.copyProperties(registerCommand, teacher);
            return teacher;
        }
    public static Teacher getTeacher(User user, Teacher teacher) {

        teacher.setName(user.getName());
        teacher.setUserName(user.getUserName());
        teacher.setPhone(user.getPhone());
        teacher.setPassword(user.getPassword());
        teacher.setType(user.getType());
        teacher.setEmail(user.getEmail());
        teacher.setPotrait(user.getPotrait());
        teacher.setCreateTime(user.getCreateTime());
        teacher.setUpdateTime(user.getUpdateTime());
        return teacher;

    }

}
